{include="header.html"}
<!--content-->
<div class="content">
    <!--about-->
    <div class="c_box">
        <div class="member_box">
            <div class="member_menu">
                <a href="{fun SYS_URL_PATH('member_index')}" class="member_menu_item">基本信息</a>
                <a href="{fun SYS_URL_PATH('member_update')}" class="member_menu_item act">修改信息</a>
                <a href="{fun SYS_URL_PATH('login_out')}" class="member_menu_item">退出登录</a>
            </div>
            <div class="member_con">
                <form>
                    <div class="member_from_itme"><span>登录帐号：</span><input id="user_name" type="text" value="{$member['title']}" placeholder="请输入帐号（仅支持数字字母）"></div>
                    <div class="member_from_itme"><span>登录密码：</span><input id="user_pwd" type="password" value="" placeholder="初始123456"></div>
                    <div class="member_from_itme"><span>确认密码：</span><input id="user_pwd2" type="password" value="" placeholder="初始123456"></div>
                    <div class="member_from_itme"><span>图片验证：</span><input id="verifycode" type="text" value="" placeholder="验证码"><img src="" id="vercodeimg"></div>
                    <div class="member_from_itme"><span></span><input type="button" value="提交保存" id="member_up_btn"></div>
                </form>
            </div>
        </div>
    </div>
</div>
{include="footer.html"}
<script>
    // 切换验证码
    $('#vercodeimg').click(function(){
        let randomNo = Math.floor(Math.random()*100+1);
        $('#vercodeimg').attr('src', http_url+'c_captcha_img/n/a_img_code/n/w_img_code/rr/'+randomNo+http_fix);
    });
    $('#vercodeimg').trigger('click');

    // 登录
    $('#member_up_btn').click(function(){
        let user_name = $('#user_name').val();
        let user_pwd = $('#user_pwd').val();
        let user_pwd2 = $('#user_pwd2').val();
        let verifycode = $('#verifycode').val();
        if(!user_name){
            alert('登录账号不能为空');return false;
        }else if(!user_pwd){
            alert('登录密码不能为空');return false;
        }else if(!user_pwd2){
            alert('确认密码不能为空');return false;
        }else if(user_pwd != user_pwd2){
            alert('密码不一致');return false;
        }else if(!verifycode){
            alert('图片验证码不能为空');return false;
        }
        $.post("{fun SYS_URL_PATH('member_update')}",{
            user_name:user_name,
            user_pwd:user_pwd,
            user_pwd2:user_pwd2,
            verifycode:verifycode,
            sub_flag:1,
            still:1
        },function(res){
            console.log(res);
            if(res.code == '10000'){
                alert('修改成功，请重新登录');
                window.location.href="{fun SYS_URL_PATH('login')}";
            }else{
                alert('登录失败：'+res.msg);
            }
        },'json').error(function(e){
            alert('网络异常');
        })
    })
</script>